﻿namespace ExamV5.WorkExam
{
    using ExamV5;
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmJoinExamParm : Page
    {
        protected HtmlInputHidden EndTime;
        protected HtmlForm Form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private HttpCookie httpCookie_4 = null;
        protected Image ImageUser;
        protected int intPaperID = 0;
        protected Label labDeptName;
        protected Label labExamName;
        protected Label labUserCode;
        protected Label labUserName;
        private PublicFun publicFun_0 = new PublicFun();
        protected HtmlInputHidden StartTime;
        protected HtmlInputHidden SumTime;
        protected HtmlInputHidden txtHideComm;
        protected HtmlInputHidden txtHideEnter;

        private void method_0()
        {
            string strSql = "";
            string str2 = Convert.ToString(base.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]);
            switch (str2)
            {
                case "":
                case null:
                    str2 = Convert.ToString(base.Request.ServerVariables["REMOTE_ADDR"]);
                    break;
            }
            strSql = string.Concat(new object[] { "update WorkExamUser set LastDate='", DateTime.Now.ToShortDateString(), "',LoginIP='", str2, "' where UserCode='", this.httpCookie_0.Value.Trim(), "' and PaperID=", this.intPaperID });
            this.publicFun_0.ExecuteSql(strSql);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            this.httpCookie_4 = new HttpCookie("ExamDeptName");
            this.httpCookie_4 = base.Request.Cookies["ExamDeptName"];
            if (!((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false))
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
            else
            {
                this.intPaperID = Convert.ToInt32(base.Request["PaperID"].ToString());
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.httpCookie_4.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_4.Value));
                if (base.IsPostBack)
                {
                    this.method_0();
                }
                else
                {
                    this.labUserCode.Text = this.httpCookie_0.Value;
                    this.labUserName.Text = this.httpCookie_1.Value;
                    this.labDeptName.Text = this.httpCookie_4.Value;
                    if (this.labDeptName.Text.Trim().Length > 10)
                    {
                        this.labDeptName.Text = this.labDeptName.Text.Substring(0, 10) + "…";
                    }
                    string str = this.publicFun_0.GetValues("select UserPhoto from UserInfo where UserCode='" + this.httpCookie_0.Value + "'", "UserPhoto").Trim();
                    if (str != "")
                    {
                        this.ImageUser.ImageUrl = "../PublicFile/" + str;
                    }
                    this.labExamName.Text = this.publicFun_0.GetValues("select ExamName from WorkPaperInfo where  ID=" + this.intPaperID, "ExamName").Trim();
                    this.Page.Title = this.labExamName.Text;
                    if (this.labExamName.Text.Trim().Length > 0x12)
                    {
                        this.labExamName.Text = this.labExamName.Text.Substring(0, 0x12) + "…";
                    }
                }
            }
        }
    }
}

